/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aRoomDetailMemberInfo: {
                members: [],
                ownerId: '',
                name: '',
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            vc.on('aRoomDetailMember', 'switch', function (_data) {
                $that.aRoomDetailMemberInfo.ownerId = _data.ownerId;
                $that._loadARoomDetailMemberData(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aRoomDetailMember', 'paginationPlus', 'page_event',
                function (_currentPage) {
                    $that._loadARoomDetailMemberData(_currentPage, DEFAULT_ROWS);
                });
            vc.on('aRoomDetailMember', 'listOwnerData', function (_param) {
                $that._loadARoomDetailMemberData(DEFAULT_PAGE, DEFAULT_ROWS);
            });
        },
        methods: {
            _loadARoomDetailMemberData: function (_page, _row) {
                if(!$that.aRoomDetailMemberInfo.ownerId){
                    return;
                }
                let param = {
                    params: {
                        ownerId: $that.aRoomDetailMemberInfo.ownerId,
                        name: $that.aRoomDetailMemberInfo.name,
                        page:_page,
                        row:_row
                    }
                };

                //发送get请求
                vc.http.apiGet('/owner.queryAdminOwnerMembers',
                    param,
                    function (json) {
                        let _roomInfo = JSON.parse(json);
                        $that.aRoomDetailMemberInfo.members = _roomInfo.data;
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _qureyARoomDetailMember: function () {
                $that._loadARoomDetailMemberData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
           
            _viewOwnerFace: function (_url) {
                vc.emit('viewImage', 'showImage', {
                    url: _url
                });
            },

        }
    });
})(window.vc);